home *** CD-ROM | disk | FTP | other *** search
- Path: syndell.demon.co.uk!derekh
- From: Derek E J Harper <derekh@syndell.demon.co.uk>
- Newsgroups: comp.lang.c++
- Subject: Re: NewbieQ: How can I convert a text file (numbers) to a binary file ???
- Date: Sun, 31 Mar 1996 09:36:48 +0100
- Organization: Derek E J Harper
- Distribution: world
- Message-ID: <Q+7IiPAgQkXxEwEs@syndell.demon.co.uk>
- References: <4jakb6$mgi@news.acns.nwu.edu>
- NNTP-Posting-Host: syndell.demon.co.uk
- X-NNTP-Posting-Host: syndell.demon.co.uk
- MIME-Version: 1.0
- X-Newsreader: Turnpike Version 1.12 <hV17jOOVcs+gcI53Ntd6703JWh>
-
- In article <4jakb6$mgi@news.acns.nwu.edu>, shchoi
- <shchoi@casbah.acns.nwu.edu> writes
- >
- >Please, help me.
- >
- >I have a text data file which is just all numbers.
- >How can I read this file and write to a binary file for conversion
- >using C ?
- >
- >I will really appreciate your help.
- >Thanks.
- >
- >
- >p.s. please e-mail me too.
- >
-
- You could fscanf() the numbers of the input file
-
- fscanf( file_ptr, "%d", &out_int );
-
- or once they are loaded you could atoi() them
-
- out_int = atoi(int_str);
-
- Cheers,
- .-The--.
- / ____| Derek E J Harper - derekh@syndell.demon.co.uk
- | |____ 'The C Side' page - http://www.geocities.com/SiliconValley/2286
- \ | :: I know the truth is out there ::
- '-Side-' :: but I'm just too comfortable in here ::
-